package com.cgtong.android.mvp.model;

import com.cgtong.android.http.ApiManager;
import com.cgtong.android.http.ConstantManager;
import com.cgtong.android.mvp.contract.ForgetPasswordContract;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.CallBackProxy;
import com.zhouyou.http.callback.SimpleCallBack;
import com.zhouyou.http.model.ApiResult;

/**
 * Created by Sky.Bing on 2017/10/23.
 */

public class ForgetPasswordModel implements ForgetPasswordContract.Model {
    @Override
    public void sendValidCode(String phone, SimpleCallBack<Object> callBack) {
        EasyHttp.post(ApiManager.URL_SEND_VALIDCODE)
                .params("mobile", phone)
                .params("codeType", ConstantManager.VALID_CODE_FORGET_PWD)
                .execute(new CallBackProxy<ApiResult<Object>, Object>(callBack) {
                });
    }

    @Override
    public void saveForgetPwd(String confirmPassword, String mobile, String newPassword, String validCode, SimpleCallBack<Object> callBack) {
        EasyHttp.post(ApiManager.URL_SAVE_FORGET_PASSWORD)
                .params("confirmPassword", confirmPassword)
                .params("mobile", mobile)
                .params("newPassword", newPassword)
                .params("validCode", validCode)
                .execute(new CallBackProxy<ApiResult<Object>, Object>(callBack) {
                });
    }
}